//生成敌机对象
/*
 kind:敌机的类别，1:敌机样式1，2:敌机样式2，3:敌机样式3
 image:存储敌机的图片对象
 * */
function Enemy(kind, image) {
	this.image = image;
	if(kind == 1) {
		this.w = 38;
		this.h = 34;
		this.speed = 2;
		this.blood = 5;
		this.x = getRandom(0,myCanvas.width-38);
	}else if(kind == 2) {
		this.w = 110;
		this.h = 164;
		this.speed = 1;
		this.blood = 10;
		this.x = getRandom(0,myCanvas.width-110);
	}else if(kind == 3) {
		this.w = 46;
		this.h = 64;
		this.speed = 1.5;
		this.blood = 6;
		this.x = getRandom(0,myCanvas.width-46);
	}
	this.hp = this.blood; //存储当前每一个飞机对象的总血量
	this.positionX = 0; //存储截取的图片的水平方向的坐标
	this.y = -this.h;
}
//定义函数用来完成敌机的样式的绘制
Enemy.prototype.draw = function() {
	ctx.drawImage(this.image,this.positionX,0,this.w,this.h,this.x,this.y,this.w,this.h);
}
//定义函数完成敌机的移动
Enemy.prototype.move = function() {
	this.y += this.speed;
}




//定义函数用来生成随机数[min max]
function getRandom(min,max) {
	return Math.floor(Math.random()*(max-min+1)+min);
}



